<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">











<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>nntp//rss-ng - CPD Results</title>
    <style type="text/css" media="all">
      @import url("./css/maven-base.css");
      @import url("./css/maven-theme.css");
      @import url("./css/site.css");
    </style>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
      </head>
  <body class="composite">
    <div id="banner">
                    <span id="bannerLeft">
    
            nntp//rss-ng
    
            </span>
                    <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
          
  

  
    
  
  
    
            <div class="xleft">
        Last Published: 2008-07-26
                      </div>
            <div class="xright">            <a href="">nntp//rss-ng</a>
            
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
           
  

  
    
  
  
    
                             <h5>Project Documentation</h5>
            <ul>
              
                
              
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
              
        <li class="collapsed">
                    <a href="project-info.html">Project Information</a>
                </li>
              
                
              
            
            
      
            
      
            
      
            
      
            
      
              
            <li class="expanded">
                    <a href="project-reports.html">Project Reports</a>
                  <ul>
                  
    <li class="none">
              <strong>CPD Report</strong>
        </li>
                  
    <li class="none">
                    <a href="dashboard-report.html">DashBoard Report</a>
          </li>
                  
    <li class="none">
                    <a href="findbugs.html">FindBugs Report</a>
          </li>
                  
    <li class="none">
                    <a href="pmd.html">PMD Report</a>
          </li>
                  
    <li class="none">
                    <a href="xref/index.html">Source Xref</a>
          </li>
                  
    <li class="none">
                    <a href="taglist.html">Tag List</a>
          </li>
              </ul>
        </li>
          </ul>
                                           <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
            <img alt="Built by Maven" src="./images/logos/maven-feather.png"></img>
          </a>
                       
  

  
    
  
  
    
        </div>
    </div>
    <div id="bodyColumn">
      <div id="contentBox">
        <div class="section"><h2>CPD Results</h2>
<p>The following document contains the results of PMD's  <a class="externalLink" href="http://pmd.sourceforge.net/cpd.html">CPD</a>
 4.2.2.</p>
</div>
<div class="section"><h2>Duplications</h2>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/db/DerbyChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/DerbyChannelDAO.html#252">252</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/db/MySQLChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/MySQLChannelDAO.html#244">244</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>                                    + &quot;, 0, &quot;
                                    + Channel.STATUS_OK
                                    + &quot;, &quot;
                                    + 
                                    + Channel.EXPIRATION_KEEP
                                    + &quot;)&quot;);

                        for (int channelCount = 0;
                            channelCount &lt; channelList.getLength();
                            channelCount++) {
                            Element channelElm =
                                (Element) channelList.item(channelCount);
                            String url = channelElm.getAttribute(&quot;url&quot;);
                            String name = channelElm.getAttribute(&quot;name&quot;);

                            int paramCount = 1;
                            ps.setString(paramCount++, url);
                            ps.setString(paramCount++, name);
                            ps.setTimestamp(
                                paramCount++,
                                new Timestamp(System.currentTimeMillis()));
                            // Last Article
                            ps.setInt(paramCount++, 0);
                            ps.executeUpdate();
                        }
                    }
                }

            } catch (SQLException se) {

                if (log.isEnabledFor(Priority.ERROR)) {
                    log.error(&quot;Error loading initial channels&quot;, se);
                }
                throw new RuntimeException(
                    &quot;Error loading initial channels - &quot; + se.getMessage());

            } finally {
                try {
                    if (ps != null)
                        ps.close();
                } catch (Exception e) {
                }
                try {
                    if (conn != null)
                        conn.close();
                } catch (Exception e) {
                }
            }

            if (log.isInfoEnabled()) {
                log.info(&quot;Finished loading initial channels&quot;);
            }
        }

    }

    protected void upgradeDatabase(int dbVersion) {
        Connection conn = null;
        Statement stmt = null;

        if (log.isInfoEnabled()) {
            log.info(
                &quot;Upgrading database from db v&quot;
                    + dbVersion
                    + &quot; to db v&quot;
                    + DBVERSION);
        }

        try {
            conn =
                DriverManager.getConnection(JdbcChannelDAO.POOL_CONNECT_STRING);
            stmt = conn.createStatement();

            switch (dbVersion) {
                // v0.1 updates
                case 0 :
                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_CONFIG
                            + &quot; ADD COLUMN contentType int&quot;);
                    stmt.executeUpdate(
                        &quot;UPDATE &quot;
                            + TABLE_CONFIG
                            + &quot; SET contentType = &quot;
                            + AppConstants.CONTENT_TYPE_MIXED);
                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_CONFIG
                            + &quot; ADD COLUMN dbVersion int&quot;);

                    // Channel
                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_CHANNELS
                            + &quot; ADD COLUMN title varchar(255)&quot;);
                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_CHANNELS
                            + &quot; ADD COLUMN link blob&quot;);
                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_CHANNELS
                            + &quot; ADD COLUMN description blob&quot;);

                    // Items
                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_ITEMS
                            + &quot; ADD COLUMN comments blob&quot;);

                case 2 :
                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_CONFIG
                            + &quot; ADD COLUMN nntpSecure bit&quot;);
                    stmt.executeUpdate(
                        &quot;UPDATE &quot;
                            + TABLE_CONFIG
                            + &quot; SET nntpSecure = &quot;
                            + MYSQL_FALSE);</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/db/DerbyChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/DerbyChannelDAO.html#473">473</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/db/MySQLChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/MySQLChannelDAO.html#465">465</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>                            + &quot;, hostName = '&quot;
                            + AppConstants.getCurrentHostName()
                            + &quot;'&quot;);

                    stmt.executeUpdate(
                        &quot;CREATE INDEX fk_channel ON &quot;
                            + TABLE_ITEMS
                            + &quot; (channel)&quot;);

				case 5 :
					stmt.executeUpdate(
						&quot;ALTER TABLE &quot;
							+ TABLE_CHANNELS
							+ &quot; ADD COLUMN lastCleaned timestamp&quot;);

                default :
                    // Force re-poll of all channels after DB upgrade...
                    stmt.executeUpdate(
                        &quot;UPDATE &quot;
                            + TABLE_CONFIG
                            + &quot; SET dbVersion = &quot;
                            + DBVERSION);
                    stmt.executeUpdate(
                        &quot;UPDATE &quot;
                            + TABLE_CHANNELS
                            + &quot; SET lastPolled = null, lastModified = null, lastETag = null&quot;);
            }

            if (log.isInfoEnabled()) {
                log.info(&quot;Successfully upgraded database.&quot;);
            }

        } catch (SQLException se) {
            throw new RuntimeException(&quot;Problem upgrading database&quot; + se);
        } finally {
            try {
                if (stmt != null)
                    stmt.close();
            } catch (Exception e) {
            }
            try {
                if (conn != null)
                    conn.close();
            } catch (Exception e) {
            }
        }
    }

    public void addChannel(Channel channel) {
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        Statement s = null;

        try {
            conn =
                DriverManager.getConnection(JdbcChannelDAO.POOL_CONNECT_STRING);
            ps =
                conn.prepareStatement(
                    &quot;INSERT INTO &quot;
                        + TABLE_CHANNELS
                        + &quot;(url, name, lastArticle, created, enabled, postingEnabled, publishAPI, publishConfig, parseAtAllCost, pollingInterval, status, expiration) &quot;
                        + &quot;values(?, ?, 0, ?, ?, ?, ?, ?, ?, ?, ?, ?)&quot;);

            int paramCount = 1;
            ps.setString(paramCount++, channel.getUrl());
            ps.setString(paramCount++, trim(channel.getName(), FIELD_CHANNEL_NAME_LENGTH));
            ps.setTimestamp(
                paramCount++,
                new Timestamp(channel.getCreated().getTime()));
            ps.setBoolean(paramCount++, channel.isEnabled());
            ps.setBoolean(paramCount++, channel.isPostingEnabled());
            ps.setString(paramCount++, channel.getPublishAPI());
            ps.setString(
                paramCount++,
                XMLHelper.stringMapToXML(channel.getPublishConfig()));
            ps.setBoolean(paramCount++, channel.isParseAtAllCost());
            ps.setLong(paramCount++, channel.getPollingIntervalSeconds());
            ps.setInt(paramCount++, channel.getStatus());
            ps.setLong(paramCount++, channel.getExpiration());
            ps.executeUpdate();

            ps.close();
            ps = null;

            s = conn.createStatement();
            rs = s.executeQuery(&quot;SELECT LAST_INSERT_ID()&quot;);</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/publish/MetaWeblogPublisher.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/publish/MetaWeblogPublisher.html#53">53</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/publish/MovableTypePublisher.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/publish/MovableTypePublisher.html#52">52</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>    private static final String STRUCT_TITLE = &quot;title&quot;;
    private static final String STRUCT_DESCRIPTION = &quot;description&quot;;
    private static final String STRUCT_LINK = &quot;link&quot;;

    /**
     * @see org.methodize.nntprss.feed.publish.Publisher#publish(Map, String)
     */
    public void publish(Map profile, Item content) throws PublisherException {

        // blogger.newPost takes the following parameters. All are required: 
        //
        try {
            XmlRpcClient xmlrpc =
                new XmlRpcClient((String) profile.get(PROP_PUBLISHER_URL));
            Vector params = new Vector();

            // blogid (string): Unique identifier of the blog the post will be added to. 
            params.addElement(profile.get(PROP_BLOG_ID));

            // username (string): Login for a Blogger user who has permission to post to the blog. 
            params.addElement(profile.get(PROP_USERNAME));

            // password (string): Password for said username. 
            params.addElement(profile.get(PROP_PASSWORD));

            // struct - title, link, description
            Map struct = new Hashtable();

            if (content.getTitle() != null) {
                struct.put(STRUCT_TITLE, content.getTitle());
            }

            if (content.getDescription() != null) {
                struct.put(STRUCT_DESCRIPTION, content.getDescription());
            }

            if (content.getLink() != null) {
                struct.put(STRUCT_LINK, content.getLink());
            }

            // content (string): Contents of the post. 
            params.addElement(struct);

            // publish (boolean): If true, the blog will be published immediately after the post is made. 
            params.addElement(
                Boolean.valueOf((String) profile.get(PROP_PUBLISH)));

            /* String postId = (String) */ xmlrpc.execute(METHOD_NEWPOST, params);

        } catch (Exception e) {
            throw new PublisherException(e);
        }
    }

    /**
     * @see org.methodize.nntprss.feed.publish.Publisher#validate(Map)
     */
    public void validate(Map profile) throws PublisherException {
        // MetaWebLog API does not currently expose an endpoint
        // that can be used for URL / username / password validation
        // Can't use blogger.getUserInfo, as not supported by Radio
        // Use metaWeblog.getCategories

        try {
            XmlRpcClient xmlrpc =
                new XmlRpcClient((String) profile.get(PROP_PUBLISHER_URL));
            Vector params = new Vector();
            // blogid (string): Unique identifier of the blog the post will be added to. 
            params.addElement(profile.get(PROP_BLOG_ID));

            // username (string): Login for a Blogger user who has permission to post to the blog. 
            params.addElement(profile.get(PROP_USERNAME));

            // password (string): Password for said username. 
            params.addElement(profile.get(PROP_PASSWORD));

            /* List categories =
                (List) */ xmlrpc.execute(METHOD_GETCATEGORYLIST, params);</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/db/DerbyChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/DerbyChannelDAO.html#188">188</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/db/MySQLChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/MySQLChannelDAO.html#180">180</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>            +&quot;, '&quot; + AppConstants.getCurrentHostName() + &quot;' &quot; + &quot;)&quot;);

        } catch (SQLException se) {

            if (log.isEnabledFor(Priority.ERROR)) {
                log.error(&quot;Error creating application database tables&quot;, se);
            }
            throw new RuntimeException(
                &quot;Error creating application tables - &quot; + se.getMessage());

        } finally {
            try {
                if (stmt != null)
                    stmt.close();
            } catch (Exception e) {
            }
            try {
                if (conn != null)
                    conn.close();
            } catch (Exception e) {
            }
        }

        if (log.isInfoEnabled()) {
            log.info(&quot;Finished creating application database tables&quot;);
        }

    }

    protected void populateInitialChannels(Document config) {
        Connection conn = null;
        PreparedStatement ps = null;

		if (!migrateHsql()) {

            if (log.isInfoEnabled()) {
                log.info(&quot;Loading channels&quot;);
            }

            try {
                conn =
                    DriverManager.getConnection(
                        JdbcChannelDAO.POOL_CONNECT_STRING);
                NodeList channelsList =
                    config.getDocumentElement().getElementsByTagName(
                        &quot;channels&quot;);

                if (channelsList.getLength() &gt; 0) {
                    Element channelsElm = (Element) channelsList.item(0);
                    NodeList channelList =
                        channelsElm.getElementsByTagName(&quot;channel&quot;);
                    if (channelList.getLength() &gt; 0) {

                        ps =
                            conn.prepareStatement(
                                &quot;INSERT INTO &quot;
                                    + TABLE_CHANNELS
                                    + &quot;(url, name, created, lastPolled, lastArticle, enabled, postingEnabled, parseAtAllCost, pollingInterval, status, expiration) &quot;</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/admin/AdminServlet.java</td>
<td><a href="./xref/org/methodize/nntprss/admin/AdminServlet.html#2768">2768</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/admin/AdminServlet.java</td>
<td><a href="./xref/org/methodize/nntprss/admin/AdminServlet.html#3143">3143</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>                        request.getParameter(&quot;expiration&quot; + channelCount));
                //				boolean historical = false;
                //	// FIXME check
                //				if(historicalStr != null) {
                //					historical = true;
                //				}

                // Check name...
                List currentErrors = new ArrayList();
                Channel existingChannel = channelManager.channelByName(name);

                if (name.length() == 0) {
                    currentErrors.add(
                        &quot;Channel with empty name - URL=&quot; + urlString);
                } else if (name.indexOf(' ') &gt; -1) {
                    currentErrors.add(
                        &quot;Channel name cannot contain spaces - name=&quot; + name);
                } else if (existingChannel != null) {
                    currentErrors.add(
                        &quot;Channel name &quot; + name + &quot; is already is use&quot;);
                }

                if (urlString.length() == 0) {
                    currentErrors.add(
                        &quot;URL cannot be empty, channel name=&quot; + name);
                } else if (
                    urlString.equals(&quot;http://&quot;)
                        || urlString.equals(&quot;https://&quot;)) {
                    currentErrors.add(
                        &quot;You must specify a URL, channel name=&quot; + name);
                } else if (
                    !urlString.startsWith(&quot;http://&quot;)
                        &amp;&amp; !urlString.startsWith(&quot;https://&quot;)) {
                    currentErrors.add(
                        &quot;Only URLs starting http:// or https:// are supported, channel name=&quot;
                            + name
                            + &quot;, url=&quot;
                            + urlString);
                }

                if (existingChannel == null) {

                    Channel newChannel = null;
                    if (currentErrors.size() == 0) {
                        try {
                            newChannel = new Channel(name, urlString);
                            //							newChannel.setHistorical(historical);
                            newChannel.setExpiration(expiration);
                            channelManager.addChannel(newChannel);
                            channelsAdded++;
                        } catch (MalformedURLException me) {
                            errors.add(
                                &quot;Channel &quot;
                                    + name
                                    + &quot; - URL (&quot;
                                    + urlString
                                    + &quot;) is malformed&quot;);
                        }
                    }</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/db/DerbyChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/DerbyChannelDAO.html#559">559</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/db/MySQLChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/MySQLChannelDAO.html#551">551</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>            rs = s.executeQuery(&quot;SELECT LAST_INSERT_ID()&quot;);

            if (rs != null) {
                if (rs.next()) {
                    channel.setId(rs.getInt(1));
                }
            }
        } catch (SQLException se) {
            throw new RuntimeException(se);
        } finally {
            try {
                if (ps != null)
                    ps.close();
            } catch (SQLException se) {
            }
            try {
                if (s != null)
                    s.close();
            } catch (SQLException se) {
            }
            try {
                if (conn != null)
                    conn.close();
            } catch (SQLException se) {
            }
        }

    }

    public void addCategory(Category category) {
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        Statement s = null;

        try {
            conn =
                DriverManager.getConnection(JdbcChannelDAO.POOL_CONNECT_STRING);
            ps =
                conn.prepareStatement(
                    &quot;INSERT INTO &quot;
                        + TABLE_CATEGORIES
                        + &quot;(name, lastArticle, created) &quot;
                        + &quot;values(?, 0, ?)&quot;);

            int paramCount = 1;
            ps.setString(paramCount++, category.getName());
            ps.setTimestamp(
                paramCount++,
                new Timestamp(category.getCreated().getTime()));
            ps.executeUpdate();

            ps.close();
            ps = null;

            s = conn.createStatement();
            rs = s.executeQuery(&quot;SELECT LAST_INSERT_ID()&quot;);</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/db/JdbcChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/JdbcChannelDAO.html#992">992</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/db/JdbcChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/JdbcChannelDAO.html#1848">1848</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>                            new Integer(rs.getInt(&quot;channel&quot;))));
                    item.setDate(rs.getTimestamp(&quot;dtStamp&quot;));
                    item.setTitle(rs.getString(&quot;title&quot;));
                    item.setCreator(rs.getString(&quot;creator&quot;));

                    if (!onlyHeaders) {
                        item.setDescription(rs.getString(&quot;description&quot;));
                        item.setLink(rs.getString(&quot;link&quot;));
                        item.setComments(rs.getString(&quot;comments&quot;));
                        item.setGuid(rs.getString(&quot;guid&quot;));
                        item.setGuidIsPermaLink(
                            rs.getBoolean(&quot;guidIsPermaLink&quot;));
                    }
                    items.add(item);
                    if (limit != LIMIT_NONE &amp;&amp; items.size() == limit) {
                        // Break if maximum items returned...
                        break;
                    }
                }
            }
        } catch (SQLException se) {
            throw new RuntimeException(se);
        } finally {
            try {
                if (rs != null)
                    rs.close();
            } catch (SQLException se) {
            }
            try {
                if (ps != null)
                    ps.close();
            } catch (SQLException se) {
            }
            try {
                if (conn != null)
                    conn.close();
            } catch (SQLException se) {
            }
        }

        return items;

    }

    /* (non-Javadoc)
     * @see org.methodize.nntprss.feed.db.ChannelDAO#loadNextItem(org.methodize.nntprss.feed.Category, int)
     */
    public Item loadNextItem(Category category, int relativeArticleNumber) {</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/admin/AdminServlet.java</td>
<td><a href="./xref/org/methodize/nntprss/admin/AdminServlet.html#1966">1966</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/admin/AdminServlet.java</td>
<td><a href="./xref/org/methodize/nntprss/admin/AdminServlet.html#2211">2211</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>        writer.write(&quot;&lt;select name='expiration'&gt;&quot;);
        writeOption(
            writer,
            &quot;Keep all items&quot;,
            Channel.EXPIRATION_KEEP,
            expiration);
        writeOption(writer, &quot;Keep only current items&quot;, 0, expiration);
        writeOption(
            writer,
            &quot;Keep items for 1 day&quot;,
            (1000 * 60 * 60 * 24 * 1),
            expiration);
        writeOption(
            writer,
            &quot;Keep items for 2 days&quot;,
            (1000 * 60 * 60 * 24 * 2),
            expiration);
        writeOption(
            writer,
            &quot;Keep items for 4 days&quot;,
            (1000 * 60 * 60 * 24 * 4),
            expiration);
        writeOption(
            writer,
            &quot;Keep items for 1 week&quot;,
            (1000 * 60 * 60 * 24 * 7),
            expiration);
        writeOption(
            writer,
            &quot;Keep items for 2 weeks&quot;,
            (1000 * 60 * 60 * 24 * 14),
            expiration);
        writeOption(
            writer,
            &quot;Keep items for 4 weeks&quot;,
            (1000 * 60 * 60 * 24 * 28),
            expiration);
		writeOption(
			writer,
			&quot;Keep items for 6 months&quot;,
			((1000 * 60 * 60 * 24) * 180),
			expiration);
		writeOption(
			writer,
			&quot;Keep items for 1 year&quot;,
			((1000 * 60 * 60 * 24) * 365),
			expiration);

        writer.write(&quot;&lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;&quot;);</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/parser/AtomParser.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/parser/AtomParser.html#317">317</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/parser/RSSParser.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/parser/RSSParser.html#351">351</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>                    item.setCreator(dcCreator);

                    if (pubDate == null) {
                        item.setDate(retrievalDate.getTime());
                        // Add 1 second - to introduce some distinction date-wise
                        // between items
                        retrievalDate.add(Calendar.SECOND, 1);
                    } else {
                        item.setDate(pubDate);
                    }

					// Invoke ItemProcessor
					invokeProcessors(item);

                    // persist to database...
                    channelDAO.saveItem(item);
                    channel.setTotalArticles(channel.getTotalArticles() + 1);
                }
            }

        }

        if (!keepHistory) {
            if (currentSignatures.size() &gt; 0) {
                if (channel.getExpiration() == 0) {
                    channelDAO.deleteItemsNotInSet(channel, currentSignatures);
					channel.setTotalArticles(currentSignatures.size());
                } else if (
                    channel.getExpiration() &gt; 0
                        &amp;&amp; (channel.getLastCleaned() == null || channel.getLastCleaned().before(
                            new Date(
                                System.currentTimeMillis()
                                    - Channel.CLEANING_INTERVAL)))) {
                    channelDAO.deleteExpiredItems(channel, currentSignatures);
                    channel.setLastCleaned(new Date());
                }
            }
        }
    }</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/publish/MetaWeblogPublisher.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/publish/MetaWeblogPublisher.html#140">140</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/publish/MovableTypePublisher.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/publish/MovableTypePublisher.html#139">139</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>        MovableTypePublisher pub = new MovableTypePublisher();

        Map profile = new HashMap();

        try {
            BufferedReader reader =
                new BufferedReader(new InputStreamReader(System.in));
            System.out.println(&quot;Blog id?&quot;);
            String blogId = reader.readLine();

            System.out.println(&quot;Username?&quot;);
            String userName = reader.readLine();

            System.out.println(&quot;Password?&quot;);
            String password = reader.readLine();

            System.out.println(&quot;Description?&quot;);
            String description = reader.readLine();

            System.out.println(&quot;Publish (true/false)?&quot;);
            String publishStr = reader.readLine();
            boolean publish = publishStr.equalsIgnoreCase(&quot;true&quot;);

            profile.put(PROP_BLOG_ID, blogId);
            profile.put(PROP_PASSWORD, password);
            profile.put(PROP_PUBLISH, new Boolean(publish));
            profile.put(PROP_USERNAME, userName);

            profile.put(
                Publisher.PROP_PUBLISHER_URL,</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/admin/AdminServlet.java</td>
<td><a href="./xref/org/methodize/nntprss/admin/AdminServlet.html#2208">2208</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/admin/AdminServlet.java</td>
<td><a href="./xref/org/methodize/nntprss/admin/AdminServlet.html#2415">2415</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>            writer.write(
                &quot;&lt;tr&gt;&lt;td class='row1' align='right' valign='top'&gt;Item Expiration&lt;/td&gt;&lt;td class='row2'&gt;&quot;);

            writer.write(&quot;&lt;select name='expiration'&gt;&quot;);
            writeOption(
                writer,
                &quot;Keep all items&quot;,
                Channel.EXPIRATION_KEEP,
                expiration);
            writeOption(writer, &quot;Keep only current items&quot;, 0, expiration);
            writeOption(
                writer,
                &quot;Keep items for 1 day&quot;,
                (1000 * 60 * 60 * 24 * 1),
                expiration);
            writeOption(
                writer,
                &quot;Keep items for 2 days&quot;,
                (1000 * 60 * 60 * 24 * 2),
                expiration);
            writeOption(
                writer,
                &quot;Keep items for 4 days&quot;,
                (1000 * 60 * 60 * 24 * 4),
                expiration);
            writeOption(
                writer,
                &quot;Keep items for 1 week&quot;,
                (1000 * 60 * 60 * 24 * 7),
                expiration);
            writeOption(
                writer,
                &quot;Keep items for 2 weeks&quot;,
                (1000 * 60 * 60 * 24 * 14),
                expiration);
            writeOption(
                writer,
                &quot;Keep items for 4 weeks&quot;,
                (1000 * 60 * 60 * 24 * 28),
                expiration);</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/admin/AdminServlet.java</td>
<td><a href="./xref/org/methodize/nntprss/admin/AdminServlet.html#2419">2419</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/admin/AdminServlet.java</td>
<td><a href="./xref/org/methodize/nntprss/admin/AdminServlet.html#3025">3025</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>                    writeOption(
                        writer,
                        &quot;Keep all items&quot;,
                        Channel.EXPIRATION_KEEP,
                        expiration);
                    writeOption(
                        writer,
                        &quot;Keep only current items&quot;,
                        0,
                        expiration);
                    writeOption(
                        writer,
                        &quot;Keep items for 1 day&quot;,
                        (1000 * 60 * 60 * 24 * 1),
                        expiration);
                    writeOption(
                        writer,
                        &quot;Keep items for 2 days&quot;,
                        (1000 * 60 * 60 * 24 * 2),
                        expiration);
                    writeOption(
                        writer,
                        &quot;Keep items for 4 days&quot;,
                        (1000 * 60 * 60 * 24 * 4),
                        expiration);
                    writeOption(
                        writer,
                        &quot;Keep items for 1 week&quot;,
                        (1000 * 60 * 60 * 24 * 7),
                        expiration);
                    writeOption(
                        writer,
                        &quot;Keep items for 2 weeks&quot;,
                        (1000 * 60 * 60 * 24 * 14),
                        expiration);
                    writeOption(
                        writer,
                        &quot;Keep items for 4 weeks&quot;,
                        (1000 * 60 * 60 * 24 * 28),
                        expiration);

                    writer.write(</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/admin/AdminServlet.java</td>
<td><a href="./xref/org/methodize/nntprss/admin/AdminServlet.html#1968">1968</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/admin/AdminServlet.java</td>
<td><a href="./xref/org/methodize/nntprss/admin/AdminServlet.html#3025">3025</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>                    writeOption(
                        writer,
                        &quot;Keep all items&quot;,
                        Channel.EXPIRATION_KEEP,
                        expiration);
                    writeOption(
                        writer,
                        &quot;Keep only current items&quot;,
                        0,
                        expiration);
                    writeOption(
                        writer,
                        &quot;Keep items for 1 day&quot;,
                        (1000 * 60 * 60 * 24 * 1),
                        expiration);
                    writeOption(
                        writer,
                        &quot;Keep items for 2 days&quot;,
                        (1000 * 60 * 60 * 24 * 2),
                        expiration);
                    writeOption(
                        writer,
                        &quot;Keep items for 4 days&quot;,
                        (1000 * 60 * 60 * 24 * 4),
                        expiration);
                    writeOption(
                        writer,
                        &quot;Keep items for 1 week&quot;,
                        (1000 * 60 * 60 * 24 * 7),
                        expiration);
                    writeOption(
                        writer,
                        &quot;Keep items for 2 weeks&quot;,
                        (1000 * 60 * 60 * 24 * 14),
                        expiration);
                    writeOption(
                        writer,
                        &quot;Keep items for 4 weeks&quot;,
                        (1000 * 60 * 60 * 24 * 28),
                        expiration);</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/db/JdbcChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/JdbcChannelDAO.html#789">789</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/db/JdbcChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/JdbcChannelDAO.html#852">852</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>            ps.setInt(paramCount++, previousArticleNumber);
            ps.setInt(paramCount++, channel.getId());
            rs = ps.executeQuery();

            if (rs != null) {
                if (rs.next()) {
                    item = readItemFromRS(rs, channel);
                }
            }
        } catch (SQLException se) {
            throw new RuntimeException(se);
        } finally {
            try {
                if (rs != null)
                    rs.close();
            } catch (SQLException se) {
            }
            try {
                if (ps != null)
                    ps.close();
            } catch (SQLException se) {
            }
            try {
                if (conn != null)
                    conn.close();
            } catch (SQLException se) {
            }
        }

        return item;
    }

    public Item loadItem(Channel channel, String signature) {</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/db/JdbcChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/JdbcChannelDAO.html#789">789</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/db/JdbcChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/JdbcChannelDAO.html#898">898</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>            ps.setString(paramCount++, signature);
            ps.setInt(paramCount++, channel.getId());
            rs = ps.executeQuery();

            if (rs != null) {
                if (rs.next()) {
                    item = readItemFromRS(rs, channel);
                }
            }
        } catch (SQLException se) {
            throw new RuntimeException(se);
        } finally {
            try {
                if (rs != null)
                    rs.close();
            } catch (SQLException se) {
            }
            try {
                if (ps != null)
                    ps.close();
            } catch (SQLException se) {
            }
            try {
                if (conn != null)
                    conn.close();
            } catch (SQLException se) {
            }
        }

        return item;
    }

    public List loadItems(</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/db/JdbcChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/JdbcChannelDAO.html#1051">1051</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/db/JdbcChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/JdbcChannelDAO.html#1580">1580</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>            ps.setInt(paramCount++, category.getId());

            rs = ps.executeQuery();

            if (rs != null) {
                while (rs.next()) {
                    articleNumbers.add(new Integer(rs.getInt(&quot;articleNumber&quot;)));
                }
            }
        } catch (SQLException se) {
            throw new RuntimeException(se);
        } finally {
            try {
                if (rs != null)
                    rs.close();
            } catch (SQLException se) {
            }
            try {
                if (ps != null)
                    ps.close();
            } catch (SQLException se) {
            }
            try {
                if (conn != null)
                    conn.close();
            } catch (SQLException se) {
            }
        }

        return articleNumbers;
    }

    /* (non-Javadoc)
     * @see org.methodize.nntprss.feed.db.ChannelDAO#removeChannelFromCategory(org.methodize.nntprss.feed.Channel, org.methodize.nntprss.feed.Category)
     */
    public void removeChannelFromCategory(Channel channel, Category category) {</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/db/DerbyChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/DerbyChannelDAO.html#411">411</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/db/MySQLChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/MySQLChannelDAO.html#403">403</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>                            + MYSQL_FALSE);

                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_CHANNELS
                            + &quot; ADD COLUMN managingEditor varchar(128)&quot;);

                case 3 :
                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_CHANNELS
                            + &quot; ADD COLUMN pollingInterval bigint&quot;);
                    stmt.executeUpdate(
                        &quot;UPDATE &quot;
                            + TABLE_CHANNELS
                            + &quot; SET pollingInterval = 0&quot;);

                case 4 :
                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_CONFIG
                            + &quot; ADD COLUMN footnoteUrls bit&quot;);
                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_CONFIG
                            + &quot; ADD COLUMN useProxy bit&quot;);
                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_CONFIG
                            + &quot; ADD COLUMN observeHttp301 bit&quot;);
                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_CONFIG
                            + &quot; ADD COLUMN hostName varchar(255)&quot;);

                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_ITEMS
                            + &quot; ADD COLUMN creator varchar(255)&quot;);
                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_ITEMS
                            + &quot; ADD COLUMN guid varchar(255)&quot;);
                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_ITEMS
                            + &quot; ADD COLUMN guidIsPermaLink bit&quot;);

                    stmt.executeUpdate(
                        &quot;ALTER TABLE &quot;
                            + TABLE_CHANNELS
                            + &quot; ADD COLUMN status int&quot;);

                    stmt.executeUpdate(
                        &quot;UPDATE &quot;
                            + TABLE_CONFIG
                            + &quot; SET footnoteUrls = &quot;
                            + MYSQL_TRUE</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/db/DerbyChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/DerbyChannelDAO.html#615">615</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/db/MySQLChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/MySQLChannelDAO.html#607">607</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>            rs = s.executeQuery(&quot;SELECT LAST_INSERT_ID()&quot;);

            if (rs != null) {
                if (rs.next()) {
                    category.setId(rs.getInt(1));
                }
            }
        } catch (SQLException se) {
            throw new RuntimeException(se);
        } finally {
            try {
                if (ps != null)
                    ps.close();
            } catch (SQLException se) {
            }
            try {
                if (s != null)
                    s.close();
            } catch (SQLException se) {
            }
            try {
                if (conn != null)
                    conn.close();
            } catch (SQLException se) {
            }
        }
    }

    /* (non-Javadoc)
     * @see org.methodize.nntprss.feed.db.ChannelDAO#shutdown()
     */
    public void shutdown() {</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/db/JdbcChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/JdbcChannelDAO.html#549">549</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/db/JdbcChannelDAO.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/db/JdbcChannelDAO.html#1640">1640</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>                        + &quot; WHERE channel = ?&quot;);
            paramCount = 1;
            ps.setInt(paramCount++, category.getId());
            rs = ps.executeQuery();
            if (rs.next()) {
                category.setTotalArticles(rs.getInt(1));
            }
        } catch (SQLException se) {
            throw new RuntimeException(se);
        } finally {
            try {
                if (rs != null)
                    rs.close();
            } catch (SQLException se) {
            }
            try {
                if (ps != null)
                    ps.close();
            } catch (SQLException se) {
            }
            try {
                if (conn != null)</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/methodize/nntprss/feed/parser/AtomParser.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/parser/AtomParser.html#198">198</a>
</td>
</tr>
<tr class="a"><td>org/methodize/nntprss/feed/parser/RSSParser.java</td>
<td><a href="./xref/org/methodize/nntprss/feed/parser/RSSParser.html#183">183</a>
</td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>            Element itemElm = (Element) itemList.item(itemCount);
            String signatureStr = generateItemSignature(md, itemElm);

            if (!keepHistory) {
                currentSignatures.add(signatureStr);
            }
            newItems.put(signatureStr, itemElm);
            newItemKeys.put(itemElm, signatureStr);
            orderedItems.add(itemElm);
        }

        if (newItems.size() &gt; 0) {
            // Discover new items...
            Set newItemSignatures =
                channelDAO.findNewItemSignatures(channel, newItems.keySet());

            if (newItemSignatures.size() &gt; 0) {
                for (int i = 0; i &lt; orderedItems.size(); i++) {
                    Element itemElm = (Element) orderedItems.get(i);</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
</div>

      </div>
    </div>
    <div class="clear">
      <hr/>
    </div>
    <div id="footer">
      <div class="xright">&#169;  
          2008
    
          
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>
